<?php
$v_current_style_name = "odd_row";
$v_next_style_name = "round_row";
$v_goto_url = "list/approver-af/index.php";
$v_count =  sizeof($arr_all_approver_af);
$v_current_item_id = '';
if (isset($_REQUEST['hdn_item_id'])){
	$v_current_item_id = $_REQUEST['hdn_item_id'];
}
?>
<!--Bang chua tieu de cua form-->
<table width="99%" cellpadding="0" cellspacing="0">
	<tr>
		<td class="normal_title"><?php echo CONST_APPROVER_AF_LIST_TITLE; ?></td>
		<a id="goto" href="" style=".color:white">#</a>
	</tr>
</table>
<table cellpadding="0" cellspacing="0" width="99%">
	<tr>
		<form action="index.php" name="dsp_all_approver_af" method="post">
		<input name="fuseaction" type="hidden" value="">
		<input name="hdn_item_id" type="hidden" value="">
		<input name="hdn_approver_id" type="hidden" value="">
		<input name="hdn_list_item_id" type="hidden" value="0">
	</tr>
	<tr><td height="5"></td></tr>
</table>
<!-- Bat cac phim: F12=false; Insert=true; Delete=true, ESC=false; Enter=false -->
<div id="hotkey" onKeyDown="javascript:process_hot_key(false,true,true,false,false);">
<!--Bang noi dung chua danh sach cac loai hinh xay dung-->
<table class="list_table2" width="99%" cellpadding="0" cellspacing="0">
	<col width="5%"><col width="25%"><col width="40%"><col width="10%"><col width="20%">
	<tr class="header">
		<td>#</td>
		<td align="center"><?php echo CONST_APPROVER_AF_NAME_LABEL; ?></td>
		<td align="center"><?php echo CONST_APPROVER_AF_UNIT_NAME_LABEL; ?></td>
		<td align="left"><?php echo _CONST_ORDER_LABEL; ?></td>
		<td align="center"><?php echo _CONST_STATUS_COLUMN_HEADER; ?></td>
	</tr>
</table>	
<div style="overflow: auto; width: 100%; height:120pt;padding-left:0px;margin:0px">
<table class="list_table2" width="99%" cellpadding="0" cellspacing="0">
	<col width="5%"><col width="25%"><col width="40%"><col width="10%"><col width="20%"><?php  
	if ($v_count > 0){
		for ($j = 0; $j < $v_count; $j++){
			foreach ($_SESSION['arr_all_staff'] as $v_staff){
				if ($arr_all_approver_af[$j]['1'] == $v_staff['id']){
					$v_item_id = $arr_all_approver_af[$j]['0'];
					$v_approver_af_id = $arr_all_approver_af[$j]['1'];
					$v_item_name = $v_staff['name'];
					$v_item_unit_id = $v_staff['unit_id'];
					$v_item_unit_name = _get_item_attr_by_id($_SESSION['arr_all_unit'],$v_item_unit_id,'name');
					$v_item_status = $arr_all_approver_af[$j]['2'];
					if ($v_item_status==1){$v_item_status=_CONST_STATUS_COLUMN_ACTIVE_VALUE;}else{$v_item_status=_CONST_STATUS_COLUMN_INACTIVE_VALUE;}
					$v_url = "row_onclick(" . "document.forms(0).hdn_item_id" . "," . $v_item_id . "," . "'DISPLAY_SINGLE_APPROVER_AF'" . ",'".$v_goto_url . "')";
					if ($v_current_style_name == "odd_row"){
						$v_current_style_name = "round_row";
					}else{
						$v_current_style_name = "odd_row";
					}?>	
					<tr class="<?php echo $v_current_style_name ?>"> 						
						<td  align="center">
							<input type="checkbox" name="chk_item_id" value="<?php echo $v_item_id; ?>" <?php echo $v_str_disabled;?>>
						</td>
						<td  align="left" onclick="<?php echo $v_url ;?>">
							<a name="<?php echo $v_item_id;?>"><?php echo $v_item_name; ?>&nbsp;</a>
						</td>						
						<td  align="left" onclick="<?php echo $v_url ;?>" class="normal_label">
							<a name="<?php echo $v_item_id;?>"><?php echo $v_item_unit_name; ?>&nbsp;</a>
						</td>
						<td  align="center" onclick="<?php echo $v_url ;?>" class="normal_label">
							<a name="<?php echo $v_item_id;?>"><?php echo $j+1; ?>&nbsp;</a>
						</td>
						<td  align="center" onclick="<?php echo $v_url ;?>" class="normal_label">
							<a name="<?php echo $v_item_id;?>"><?php echo $v_item_status; ?>&nbsp;</a>
						</td>
					</tr><?php 
					break;
				}		
			}//End for 2
			if ($v_current_style_name == "odd_row"){
				$v_next_style_name = "round_row";
			}else{
				$v_next_style_name = "odd_row";
			}
		}//End For 1
	}
	echo _add_empty_row($v_count,_CONST_NUMBER_OF_ROW_PER_LIST,$v_current_style_name,$v_next_style_name,5);?>
</table>
</div>
<!--Table chua cac button-->
<table align="center">
	<tr><td height="10"></td></tr>
	<tr>
		<td><?php
			//if ($v_is_granted_update ){?>
				<input type="button" value="<?php echo _CONST_ADD_BUTTON; ?>" name="btn_add" class="normal_button" onClick="btn_add_onclick(document.forms(0).hdn_item_id, 'DISPLAY_ALL_STAFF','<?php echo $v_goto_url; ?>')"><?php
		//	}	
		//	if ($v_is_granted_delete ){?>
				<input type="button" value="<?php echo _CONST_DELETE_BUTTON; ?>" name="btn_delete" class="normal_button" onClick="btn_delete_onclick(document.forms(0).chk_item_id,document.forms(0).hdn_list_item_id,'DELETE_APPROVER_AF')"><?php
		//	}?>	
		</td>
	</tr>
</table>
</div>
</form>
<Script>
	document.all.goto.href="#<? echo $v_current_item_id;?>";
	document.all.goto.click();
</Script>

